home *** CD-ROM | disk | FTP | other *** search
- Path: mail2news.demon.co.uk!genesis.demon.co.uk
- From: Lawrence Kirby <fred@genesis.demon.co.uk>
- Newsgroups: comp.lang.c,comp.std.c
- Subject: Re: Integral conversion e.t.c. (was: Re: Hungarian notation)
- Date: Wed, 07 Feb 96 12:34:11 GMT
- Organization: none
- Message-ID: <823696451snz@genesis.demon.co.uk>
- References: <30C40F77.53B5@swsbbs.com> <SPENCER.96Jan22113215@zorgon.ERA.COM> <TANMOY.96Feb2110443@qcd.lanl.gov>
- Reply-To: fred@genesis.demon.co.uk
- X-NNTP-Posting-Host: genesis.demon.co.uk
- X-Newsreader: Demon Internet Simple News v1.27
- X-Mail2News-Path: genesis.demon.co.uk
-
- In article <TANMOY.96Feb2110443@qcd.lanl.gov>
- tanmoy@qcd.lanl.gov "Tanmoy Bhattacharya" writes:
-
- >C does have implementation defined behaviour too. For example, whether
- >char is signed or unsigned is implementation defined. The
- >implementation documentation has to specify the choices made for the
- >implementation defined behaviours. The standard very clearly
- >distinguishes between implementation defined and undefined behaviour,
- >and only very rarely, as in (int)(char*)0, allows an implementation to
- >define something as undefined (This seems to be the majority view
- >here: claims have been made that implementation always has the right).
-
- "3.10 implementation-defined behaviour: Behaviour, for a correct program
- construct and correct data, that depends on the characteristics of the
- implementation and that each implementation shall document"
-
- If a correct program construct and correct data can result in undefined
- behaviour then the whole basis of C is severely flawed. There is no way
- that implementation-defined behaviour can sensibly be allowed to be
- undefined behaviour (and there is nothing in the standard that supports
- this view). In the case of (int)(char*)0 the standard (6.3.4) states the
- conditions where the behaviour is undefined; it does not allow the
- implementation to specify 'undefined' as a form of implementation-defined
- behaviour. The implementation can/must state the size of integer required
- hold a pointer (which can be none suitable) but it is still the standard
- which states, based on that information, whether a particular
- pointer->integer conversion results in undefined behaviour.
-
- --
- -----------------------------------------
- Lawrence Kirby | fred@genesis.demon.co.uk
- Wilts, England | 70734.126@compuserve.com
- -----------------------------------------
-